<template>
  <el-dialog
    title="修改参考号"
    :modal="false"
    :visible.sync="centerDialogVisible"
    width="50%"
    center
  >
    <div>
      <el-row :gutter="6">
        <el-form
          ref="paramForm"
          :model="paramData"
          size="mini"
          label-width="280px"
        >
          <el-col :span="14">
            <el-form-item label="参考号" prop="referenceNo">
              <el-input
                v-model.trim="paramData.referenceNo"
                placeholder="请输入参考号"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="centerDialogVisible = false">取 消</el-button>
      <el-button
        type="primary"
        @click="editReferenceNo"
        v-loading.fullscreen.lock="fullscreenLoading"
        >确 定</el-button
      >
    </span>
  </el-dialog>
</template>

<script>
import { ajax } from "@/store/yg/common/utils";
import axios from "axios";
import * as constant from "@/store/yg/common/constant";
import { m } from "@/store/yg/common/local";
export default {
  props: ["row", "data", "more"],
  data() {
    return {
      fullscreenLoading: false,
      centerDialogVisible: false,
      paramData: {
        id: 0,
        referenceNo: ""
      }
    };
  },

  methods: {
    //修改参考号
    editReferenceNo() {
      var param = {};
      param["id"] = this.data["id"];
      param["referenceNo"] = this.paramData.referenceNo;
      console.log("param:", param);
      this.fullscreenLoading = true;
      ajax("editReferenceNo", param).then(
        res => {
          this.fullscreenLoading = false;
          if (res.code != 200) {
            if (null != res.message) {
              this.$message.error(m(res.message));
            } else {
              this.$message.error("修改失败!");
            }
          } else {
            this.$message.success("修改成功!");
            this.centerDialogVisible = false;
            this.data.referenceNo = this.paramData.referenceNo;
          }
        },
        error => {
          console.log(error);
        }
      );
    }
  },
  mounted() {
    this.paramData.referenceNo = this.data["referenceNo"];
  }
};
</script>

<style></style>
